<template>
  <div class="mainContainer">
    <el-table
    :data="tableData.filter(data => !search || data.name.toLowerCase().includes(search.toLowerCase()))"
    style="width: 100%">
        <el-table-column
        label="时间"
        prop="date">
        </el-table-column>
        <el-table-column
        label="班级"
        prop="class">
        </el-table-column>
        <el-table-column
        label="主题"
        prop="subject">
        </el-table-column>
        <el-table-column
        align="right">
        <template slot="header">
            <el-input
            v-model="search"
            size="mini"
            placeholder="输入关键字搜索"/>
        </template>
        <template slot-scope="scope">
            <el-button
            size="mini"
            @click="handleEdit(scope.$index, scope.row)">详情</el-button>
            <el-button
            size="mini"
            type="danger"
            @click="handleDelete(scope.$index, scope.row)">Delete</el-button>
        </template>
        </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
    data(){
        return {
            tableData: [{
            date: '2016-05-02',
            class: '计算机一班',
            subject: '大家记得完成本周六的复习任务',
            ifDetail: false
            }],
            search: ''
        }
    },
    methods: {        
      handleEdit(index, row) {
        console.log(index, row);
      },
      handleDelete(index, row) {
        console.log(index, row);
      }
    }

}
</script>

<style lang="less" scoped>
.mainContainer {
    height: 100%;
    width:100%;
    display: flex;    
    justify-content: center;
    align-items:  center;
}
</style>